package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.constant.MessageConstant;
import com.itheima.entity.Result;
import com.itheima.pojo.Menu;
import com.itheima.pojo.Role;

import com.itheima.service.MenuService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/menu")
public class MenuController {
    @Reference
    private MenuService menuService;
    /**
 *  通过用户名字查找角色
 * "/menu/findMenuListByUsername",this.username
 * @param username
 * @return
 */
@RequestMapping("/findMenuListByUsername")
public Result findMenuListByUsername(String username){
    try{
        //        通过用户名字寻找角色
        List<Menu> menuList= menuService.findMenuList(username);
        return new Result(true,MessageConstant.GET_MENU_SUCCESS,menuList);
    }catch (Exception e){
        return new Result(false,MessageConstant.GET_MENU_FAIL);
    }
}
}
